<script>
import Vue from 'vue';
export default {
	globalData: {
		statusBarHeight: wx.getSystemInfoSync()['statusBarHeight']
	},
	onLaunch: function() {
		uni.getSystemInfo({
			success: function(e) {
				// #ifndef MP
				Vue.prototype.StatusBar = e.statusBarHeight;
				if (e.platform == 'android') {
					Vue.prototype.CustomBar = e.statusBarHeight + 50;
				} else {
					Vue.prototype.CustomBar = e.statusBarHeight + 45;
				}
				// #endif
				// #ifdef MP-WEIXIN
				Vue.prototype.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				Vue.prototype.Custom = custom;
				Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				// #endif
				// #ifdef MP-ALIPAY
				Vue.prototype.StatusBar = e.statusBarHeight;
				Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
				// #endif
			}
		});
		const updateManager = uni.getUpdateManager();
		updateManager.onCheckForUpdate(function(res) {
			if (res.hasUpdate) {
				updateManager.onUpdateReady(function(result) {
					uni.showModal({
						title: '更新提示',
						content: '发现新版本，是否重启应用?',
						cancelColor: '#eeeeee',
						confirmColor: '#FF0000',
						success(result) {
							if (result.confirm) {
								updateManager.applyUpdate();
							} else {
								updateManager.applyUpdate();
							}
						}
					});
				});
			}
		});
		updateManager.onUpdateFailed(function(res) {
			uni.showModal({
				title: '提示',
				content: '检查到有新版本，但下载失败，请检查网络设置',
				success(res) {
					if (res.confirm) {
						updateManager.applyUpdate();
					}
				}
			});
		});
	},
};
</script>

<style lang="scss">
@import 'uni.scss';
@import 'uview-ui/index.scss';
@import 'static/style/app.scss';
</style>

<style>
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import 'colorui/animation.css';
@import 'components/gcolor/Gcolor.css';

page {
	height: 100%;
}

.content {
	height: 100%;
}

.uList {
	padding: 0rpx;
	display: block;
	margin-top: 5upx;
}

.uList .uniListItem {
	color: #1c1c1c;
	font-size: 30px;
}
</style>
